﻿using System;
using System.Collections.Generic;
using System.Text;
using AAA.Base.Util;

namespace AAA.DataTransfer
{
    public class DateToMonthTranslate : AbstractTranslate
    {
        #region ITranslate 成員

        protected override object TryTranslate(object oValue)
        {
            DateTime dtSource = DateTime.MinValue;

            if (oValue.GetType() == typeof(DateTime))
            {
                dtSource = (DateTime)oValue;
            }
            else
            {
                try
                {
                    dtSource = DateTimeHelper.Parse(oValue.ToString());                                                   
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
            return dtSource.ToString("yyyy/MM");
        }

        #endregion
    }
}
